#ifndef XGE_XGE_H_
#define XGE_XGE_H_
#include "xge_common_config.h"
#include "xallstatic.h"
#include "xassert.h"
#include "xstring.h"


#include "g_graphics.h"
#include "scene_mgr.h"
#include "event_base.h"
#include "xfsm.h"
#include "xmainloop.h"



namespace xge{  

  using xge::AllStatic;
  using graphics::Graphics2D;
  using graphics::SceneManager;
  using event::EventManager;

  // This the internal interface for accessing the
  // resource inside of the whole system !
  class XGameEngine : public AllStatic {
  public:
    // Get the grapchis2D interface this interface will only give
    // you the real pointer instead of reference counter , since the
    // destroy will be perform by the XGameEngine itself 
    static Graphics2D* GetGraphics2D() {
      XASSERT(kGraphics2DInterface);
      return kGraphics2DInterface;
    }
    // Get the file system manager interface 
    // the user can use this function to obtain
    // the specific file system !
    static FileSystemManager* GetFileSystemManager() {
      XASSERT(kFSManager);
      return kFSManager;
    }
    // Get the scene manager interface 
    static SceneManager* GetSceneManager() {
      XASSERT(kSceneManager);
      return kSceneManager;
    }

    static EventManager* GetEventManager() {
      XASSERT(kEventManager);
      return kEventManager;
    }

    static MainLoop* GetMainLoop() {
      XASSERT(kMainLoop);
      return kMainLoop;
    }

  public:
    // create the internal game engine 
    static bool CreateGameEngine(
      size_t width , size_t height , bool fullscreen ,
      const String& caption , const String& icon_res = String(),
      DeviceType device_type = DEVICE_DEFAULT ) ;
    // you do not have to call destroy function 
    // since the internal destroy will be done 
    // automatically using at_exit_manager
  private:
    // graphics 2d interface
    static Graphics2D* kGraphics2DInterface;
    // file system manager interface
    static FileSystemManager* kFSManager;
    // scene manager interface
    static SceneManager * kSceneManager;
    // event manager interface
    static EventManager * kEventManager;
    // main loop 
    static MainLoop* kMainLoop;

  };

}// namespace xge
#endif// XGE_XGE_H_